EL PASO, Texas (AP) — The gunman who killed 23 people in a racist attack at a Walmart in El Paso — one of the deadliest mass shootings in U.S. history — pleaded guilty Monday to capital murder in a state district court.

Judge Sam Medrano told 26-year-old Patrick Crusius he failed in his attack on a community that would have welcomed him “with open arms.”

"You came to inflict terror, to take innocent lives, and to shatter a community that had done nothing but stand for kindness, unity and love. You slaughtered fathers, mothers, sons and daughters,” Medrano said.

“Now as you begin the rest of your life locked away, remember this: your mission failed," he continued. "You did not divide this city, you strengthened it. You did not silence its voice, you made it louder. You did not instill fear, you inspired unity. El Paso rose, stronger and braver.”

Crusius has acknowledged he targeted Hispanics on Aug. 3, 2019, when he opened fire in a Walmart in the Texas border city that was crowded with weekend shoppers from the U.S. and Mexico.

“Are you pleading guilty because you are guilty and for no other reason,” Medrano asked him.

“Yes, your honor,” Crusius calmly responded.

Crusius, who appeared in court wearing a striped jumpsuit, shackles and a protective vest, will be automatically sentenced to life in prison without parole.

The change of plea came after local prosecutors took the death penalty off the table. El Paso County District Attorney James Montoya said that decision was driven by a majority of victims’ relatives who want the case to be over.

Joe Spencer, one of Crusius' attorneys, said Crusius has been diagnosed with schizoaffective disorder, which can be marked by hallucinations, delusions and mood swings, and has suffered from debilitating mental illness for most of his life.

He said Crusius “became consumed by extreme ideologies found online.”

“He brought violence and terror to a place of peace,” Spencer said. “He shattered lives and forever changed the landscape of El Paso. ... We offer our deepest condolences.”

Crusius has never offered an explicit apology for his actions.

He has already been sentenced to 90 consecutive life terms at the federal level after pleading guilty to hate crimes and weapons charges.

“Patrick will leave prison only in a coffin on God’s time,” Spencer said Monday.

About 100 people from victims' families were seated in the courtroom gallery. They will be given the time to give victim impact statements starting Monday afternoon. Dozens made emotional statements during a similar hearing in federal court in 2023 that lasted for three days.

The white community-college dropout was 21 years old when police say he drove more than 700 miles (1,100 kilometers) to El Paso from his home near Dallas. He posted a racist rant online that warned of a Hispanic "invasion," then opened fire with an AK-style rifle inside and outside the store. Crusius was arrested shortly after.

The people who were killed at Walmart ranged in age from a 15-year-old high school athlete to elderly grandparents. They included immigrants, a retired city bus driver, a teacher, tradesmen including a former iron worker, and several Mexican nationals who had crossed the U.S. border on routine shopping trips.

___

Stengle contributed from Dallas.

FILE - In this Thursday, May 21, 2020 photo, Vanessa Romero holds her son at a memorial service for the 23rd victim of the Aug. 3 Walmart shooting while wearing an "El Paso Strong" T-shirt and a face mask in El Paso, Texas. AP Photo/Cedar Attanasio, File)

Credit: AP

icon to expand image

Credit: AP

FILE - A woman is reflected in a picture as she looks at a makeshift memorial at the scene of a mass shooting at a shopping complex Tuesday, Aug. 6, 2019, in El Paso, Texas. (AP Photo/John Locher, File)

Credit: AP

icon to expand image

Credit: AP

FILE - In this Aug. 12, 2019 photo, mourners visit the makeshift memorial near the Walmart in El Paso, Texas. (AP Photo/Cedar Attanasio, File)

Credit: AP

icon to expand image

Credit: AP

FILE - Eddie Medina, 62, carries groceries he bought for his wife at the reopening of the Cielo Vista Walmart, Thursday, Nov. 14, 2019, in El Paso, Texas. (AP Photo/Cedar Attanasio, File)

Credit: AP

icon to expand image

Credit: AP